﻿using System.Linq;
using System.Windows.Forms;

namespace BP.Form
{
    public partial class FrmSeznamKategorii : System.Windows.Forms.Form
    {
        public FrmSeznamKategorii()
        {
            InitializeComponent();
            
        }

        private void FrmSeznamKategoriiLoad(object sender, System.EventArgs e)
        {
            using (var dbContext = new DbContext())
            {
               // var kategories = dbContext.kategories.ToArray();
                var souteze = dbContext.soutezs.ToArray();
                dataGrid.DataSource = souteze;
                
            }
        }

        private void DataGridCellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs cellEventArgs)
        {
            DataGridViewRow dataGridViewRow = dataGrid.Rows[cellEventArgs.RowIndex];
            var frm = new FrmKategorie();
            frm.Kategorie = (kategorie) dataGridViewRow.DataBoundItem;
            frm.MdiParent = MdiParent;
            frm.Show();
        }
    }
}
